package com.roc.web.action.black;

import java.util.ArrayList;
import java.util.List;

import com.roc.page.BaseSearchCondition;
import com.roc.page.WhereHQLFieldBean;
import com.roc.util.Constance;
import com.roc.util.Utils;

public class BlackListSearchCondition extends BaseSearchCondition{

	private String acctNo;
	private String cardNo;
	private String licenseNo;
	private String mid;
	private String termId;
	private String addType;
	
	@Override
	protected List<WhereHQLFieldBean> getWhereHQLFieldBeanList() {
		// TODO Auto-generated method stub
		List<WhereHQLFieldBean> filedBeanList = new ArrayList<WhereHQLFieldBean>();
		
		if(Constance.isNotEmpty(acctNo)){ 
			filedBeanList.add(new WhereHQLFieldBean("b.acctNo", Utils.replace(acctNo.trim(), "*", "_"), "like", false,"ALL"));
		}
		if(Constance.isNotEmpty(cardNo)){ 
			filedBeanList.add(new WhereHQLFieldBean("b.cardNo", cardNo.trim(), "=", false));
		}
		if(Constance.isNotEmpty(licenseNo)){ 
			filedBeanList.add(new WhereHQLFieldBean("b.licenseNo", licenseNo.trim(), "=", false));
		}
		if(Constance.isNotEmpty(mid)){ 
			filedBeanList.add(new WhereHQLFieldBean("b.mid", mid.trim(), "=", false));
		}
		if(Constance.isNotEmpty(termId)){ 
			filedBeanList.add(new WhereHQLFieldBean("b.termId", termId.trim(), "=", false));
		}
		if(Constance.isNotEmpty(addType)&&!"99".equals(addType)){ 
			filedBeanList.add(new WhereHQLFieldBean("b.addType", addType.trim(), "=", false));
		}
		return filedBeanList;
	}

	@Override
	protected String getRowCountHQL() {
		// TODO Auto-generated method stub
		return "select count(*) from BlackList b where 1=1";
	}

	@Override
	protected String getSearchHQL() {
		// TODO Auto-generated method stub
		return "select b.acctNo,b.cardNo,b.licenseNo,b.mid,b.termId,b.addType,b.unlockTimes,b.isused,b.remark,b.dtCreate,b.dtLastmod,b.operators from BlackList b where 1=1";
	}

	@Override
	protected String getOrderPartOfHQL() {
		// TODO Auto-generated method stub
		return "order by b.dtCreate DESC";
	}

	public String getAcctNo() {
		return acctNo;
	}

	public void setAcctNo(String acctNo) {
		this.acctNo = acctNo;
	}

	public String getCardNo() {
		return cardNo;
	}

	public void setCardNo(String cardNo) {
		this.cardNo = cardNo;
	}

	public String getLicenseNo() {
		return licenseNo;
	}

	public void setLicenseNo(String licenseNo) {
		this.licenseNo = licenseNo;
	}

	public String getMid() {
		return mid;
	}

	public void setMid(String mid) {
		this.mid = mid;
	}

	public String getTermId() {
		return termId;
	}

	public void setTermId(String termId) {
		this.termId = termId;
	}

	public String getAddType() {
		return addType;
	}

	public void setAddType(String addType) {
		this.addType = addType;
	}
	
	

}
